    var timer;
    var index;
    var len=$("ul.number>li").length;
$(document).ready(function() {
	addPhoto();
    $(window).resize(function () {
            resetSize();
			clearInterval(timer);
    }); 
	$("ul.number li").mouseover(function(){
		index=$(this).index();
		slideImg(index);
	}).eq(0).mouseover();
	$(".show").hover(function(){
		clearInterval(timer);
	},function(){
		timer=setInterval(function(){
		slideImg(index);
		index++;
		if(index==len) index=0;
		},10000);
	}).trigger("mouseleave");
});
function slideImg(index){
	var v_width=document.body.clientWidth;
	$(".show").stop(true,false).animate({left:-v_width*index},600);
	$(".number li").eq(index).find("p").find("img").addClass("on").parents("li").siblings("li").find("p").find("img").removeClass("on");
	
}
/*适应屏幕宽度*/
/*触发屏幕，改变屏幕大小时触发onresize()*/
function addPhoto(){
    var imgList1920 =["images/banner2.jpg","images/banner3.jpg","images/banner4.jpg",
"images/banner5.jpg","images/banner6.jpg","images/banner7.jpg"];
     var imgList1360 =["images/banner2.jpg","images/banner3.jpg","images/banner4.jpg",
"images/banner5.jpg","images/banner6.jpg","images/banner7.jpg"];
	for(var i = 0 ; i <imgList.length;i++)
    {
          var img1920 = new Image();
          img1920.src =imgList[i];
          var img1360 = new Image();
          img1360.src =imgList[i];
		  if(document.body.clientWidth==1920){
		     $("<li/>").append(img1920).appendTo("ul.show");
	      }else if(document.body.clientWidth==1360){
			 $("<li/>").append(img1360).appendTo("ul.show");
		  }
    }
	
	 resetSize();
}

function resetSize(){
	/*if(document.body.clientWidth==1920){
		$(".slider").css("height","640px");
	}
	
	$(".slider").css("height",(document.body.clientWidth/2)+"px");
	$(".slider ul.number").css("top",document.body.clientWidth/2-240+"px");*/
	/*if(document.body.clientWidth<=640){
		
		$(".slider ul.number").css("top","120px");
	}*/
	//全局变量count
	var count = document.getElementById("thelist").getElementsByTagName("img").length;
		
	//加载页面时让每张图片适应屏幕宽高
	//alert(document.body.clientWidth)
	for(i=0;i<count;i++){
        document.getElementById("thelist").getElementsByTagName("img").item(i).style.width =document.body.clientWidth+"px";
		//document.getElementById("thelist").getElementsByTagName("img").item(i).style.height =document.body.clientWidth/2+"px";
    }
	
     //加载页面时让整体图片适应屏幕宽高
     document.getElementById("thelist").style.cssText = " width:"+document.body.clientWidth*count+"px";
}